//
//  HYGeometry.h
//  SpriteKitDemo
//
//  Created by yanghaha on 16/4/10.
//  Copyright © 2016年 hillyoung. All rights reserved.
//

#ifndef HYGeometry_h
#define HYGeometry_h


static inline CGVector HYVectorMultiply (CGVector v, CGFloat m) {
    return CGVectorMake(v.dx*m, v.dy*m);
}

static inline CGVector HYVectorBetweenPoints(CGPoint p1, CGPoint p2) {
    return CGVectorMake(p2.x-p1.x, p2.y-p1.y);
}


static inline CGFloat HYVectorLength(CGVector v) {
    return sqrtf(powf(v.dx, 2)+powf(v.dy, 2));
}


static inline CGFloat HYPointDistance(CGPoint p1, CGPoint p2) {
    return sqrtf(powf(p2.x-p1.x, 2)+powf(p2.y-p1.y, 2));
}

#endif /* HYGeometry_h */
